package com.fdd.op.sdk.request.api.company;

import com.fdd.op.sdk.ApiRuleException;
import com.fdd.op.sdk.BaseFddRequest;
import com.fdd.op.sdk.constants.Constants;
import com.fdd.op.sdk.internal.mapping.RequestField;
import com.fdd.op.sdk.internal.util.FddHashMap;
import com.fdd.op.sdk.internal.util.StringUtils;
import com.fdd.op.sdk.response.api.company.GetCompanyResponse;

import java.util.Map;

public class GetCompanyRequest extends BaseFddRequest<GetCompanyResponse> {

    @Override
    public String getApiMethodName() {
        return "/user/api/company/getCompany";
    }

    @Override
    public String getHttpMethod() {
        return Constants.METHOD_GET;
    }

    @Override
    public Map<String, Object> getTextParams() {
        FddHashMap txtParams = new FddHashMap();
        if(this.udfParams != null) {
            txtParams.putAll(this.udfParams);
        }
        return txtParams;
    }

    @Override
    public Class<GetCompanyResponse> getResponseClass() {
        return GetCompanyResponse.class;
    }

    @Override
    public void check() throws ApiRuleException {
        if(StringUtils.isBlank(getCompanyId()) && StringUtils.isBlank(getTpOrgId()) && StringUtils.isBlank(getCompanyName()) && StringUtils.isBlank(getCreditNo())){
            throw new ApiRuleException("90000", "参数不能为空");
        }
    }

    @RequestField(value = "企业在当前系统的唯一标识")
    private String companyId;

    @RequestField(value = "企业在第三方业务系统的唯一标识")
    private String tpOrgId;

    @RequestField(value = "企业名称")
    private String companyName;

    @RequestField(value = "企业的统一社会信用代码")
    private String creditNo;

    public String getCompanyId() {
        return companyId;
    }

    public void setCompanyId(String companyId) {
        this.companyId = companyId;
    }

    public String getTpOrgId() {
        return tpOrgId;
    }

    public void setTpOrgId(String tpOrgId) {
        this.tpOrgId = tpOrgId;
    }

    public String getCompanyName() {
        return companyName;
    }

    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }

    public String getCreditNo() {
        return creditNo;
    }

    public void setCreditNo(String creditNo) {
        this.creditNo = creditNo;
    }
}
